import axios from '../../../utils/http'
export async function getData(currentPage, pageSize, filter) {
  const {
    data
  } = await axios.get('/cms/teacher/teacherPageData', {
    params: {
      currentPage: currentPage,
      pageSize: pageSize,
      ...filter
    }
  })
  return data
}

export async function getListData() {
  const {
    data
  } = await axios.get('/bac/department/topDeptList')
  return data
}

export async function getListDataNew() {
  const {
    data
  } = await axios.get('/bac/department/topDeptList')
  return data
}

// 隶属部门
export async function getTopDeptList() {
  const {
    data
  } = await axios.get('/bac/department/topDeptList')
  return data
}

// 直属部门
export async function getDeptList(number) {
  const {
    data
  } = await axios.get('/bac/department/deptList', {
    params: {
      number: number
    }
  })
  return data
}

// 用户注册 /teacher/register
export async function userRegister(collegeNumber, departmentNumber, name, number, sex) {
  const {
    data
  } = await axios.post('/teacher/register', {
    collegeNumber: collegeNumber,
    departmentNumber: departmentNumber,
    name: name,
    number: number,
    sex: sex
  })
  return data
}


// 修改用户信息
export async function userUpdata(collegeNumber, departmentNumber, image, phonenumber, sex, ) {
  const {
    data
  } = await axios.put('/teacher/teacher', {

    collegeNumber: collegeNumber,
    departmentNumber: departmentNumber,
    image: image,
    phonenumber: phonenumber,
    sex: sex,

  })
  return data
}

// 修改用户密码
export async function userUpdataPass(number, oldPassword, password) {
  const {
    data
  } = await axios.patch('/user/password', {

    number: number,
    oldPassword: oldPassword,
    password: password,



  })
  return data
}

// 根据学院获取部门 /college/departmentListByCollege/
export async function getDepartmentListByCollege(college) {
  const {
    data
  } = await axios.get('/college/departmentListByCollege/' + college)
  return data
}
